package com.example.backend.tools;

import dev.langchain4j.agent.tool.P;
import dev.langchain4j.agent.tool.Tool;
import org.springframework.stereotype.Component;

@Component
public class CalculatorTools {

    @Tool(name = "sum",  value = "计算两个数字的和")
    double sum(
            @P(value = "加数1",required = true) double a,
            @P(value = "加数2",required = true) double b) {
        System.out.println("调用加法运算");
        return a + b;
    }

    @Tool(name = "squareRoot",  value = "计算一个数字的平方根")
    double squareRoot(
            @P(value = "被开方数",required = true) double x) {
        System.out.println("调用平方根运算");
        return Math.sqrt(x);
    }

    @Tool(name = "multiply",  value = "计算两个数字的乘积")
    double multiply(
            @P(value = "乘数1",required = true) double a,
            @P(value = "乘数2",required = true) double b) {
        System.out.println("调用乘法运算");
        return a * b;
    }
}